
/* 登录接口函数 */
import request from './ajax.ts'
export function reqLogin(data) {
    // console.log('data', data);
    return request.post('/back/v1/user/login', data)
}

export function getUserList(params, {page, size}) {
    return request({
        url: '/back/v1/user/list',
        method: 'get',
        headers: {
            'Authorization': 'Bearer ' + params
        },
        params: {
            page, size
        }
    })
}

export function addUserReq(token, data) {
    console.log('token', token);
    console.log('data',data);
    return request({
        url:'/back/v1/user/add',
        method: 'post',
        headers: {
            'Authorization': 'Bearer ' + token
        },
        data
    })
}

export function getModeListReq(params, userId) {
    return request({
        url: '/back/v1/module/list/user',
        method: 'get',
        headers: {
            'Authorization': 'Bearer ' + params
        },params: {
            user_id: userId
        }
    })
}

export function getModeDetailReq(params, id) {
    return request({
        url: '/back/v1/module/detail',
        method: 'get',
        headers: {
            'Authorization': 'Bearer ' + params
        },
        params: {id}
    })
}

export function getAllModeListReq(params) {
    return request({
        url: '/back/v1/module/list/all',
        method: 'get',
        headers: {
            'Authorization': 'Bearer ' + params
        }
    })
}

export function editModleReq(token, data) {
    return request({
        url:'/back/v1/module/update',
        method: 'post',
        headers: {
            'Authorization': 'Bearer ' + token
        },
        data
    })
}

export function addScore(token, data) {
    // console.log('token', token);
    // console.log('data', data);
    return request({
        url:'/back/v1/user/add/score',
        method: 'post',
        headers: {
            'Authorization': 'Bearer ' + token
        },
        data
    })
}

export function addModelValueReq(token, data) {
    return request({
        url:'/back/v1/user/auth',
        method: 'post',
        headers: {
            'Authorization': 'Bearer ' + token
        },
        data
    })
}